<?php
namespace Amis\functions;

use Amis\Basics\AmisBasics;

class NavOverflow extends AmisBasics
{
    public bool   $enable            = true;
    public string $overflowListClassName;
    public string $overflowPopoverClassName;
    public string $overflowClassName;
    public string $style;
    public string $wrapperComponent;
    public object $overflowLabel;
    public string $overflowIndicator = 'fa fa-ellipsis';
    public int    $maxVisibleCount;

    public function enable(bool $enable = true)
    {
        $this->enable = $enable;
        return $this;
    }

    /**
     * 菜单外层 CSS 类名
     * @param string $overflowListClassName
     * @return $this
     */
    public function overflowListClassName(string $overflowListClassName)
    {
        $this->overflowListClassName = $overflowListClassName;
        return $this;
    }

    /**
     * Popover 浮层 CSS 类名
     * @param string $overflowPopoverClassName
     * @return $this
     */
    public function overflowPopoverClassName(string $overflowPopoverClassName)
    {
        $this->overflowPopoverClassName = $overflowPopoverClassName;
        return $this;
    }

    /**
     * 菜单按钮 CSS 类名
     * @param string $overflowClassName
     * @return $this
     */
    public function overflowClassName(string $overflowClassName)
    {
        $this->overflowClassName = $overflowClassName;
        return $this;
    }

    /**
     * 自定义样式
     * @param string $style
     * @return $this
     */
    public function style(string $style)
    {
        $this->style = $style;
        return $this;
    }

    /**
     * 包裹导航的外层标签名，可以使用其他标签渲染
     * @param string $wrapperComponent
     * @return $this
     */
    public function wrapperComponent(string $wrapperComponent)
    {
        $this->wrapperComponent = $wrapperComponent;
        return $this;
    }

    /**
     * 菜单触发按钮的文字
     * @param object|string $overflowLabel
     * @return $this
     */
    public function overflowLabel(object $overflowLabel)
    {
        $this->overflowLabel = $overflowLabel;
        return $this;
    }

    /**
     * 菜单触发按钮的文字
     * @param string $overflowIndicator
     * @return $this
     */
    public function overflowIndicator(string $overflowIndicator = 'fa fa-ellipsis')
    {
        $this->overflowIndicator = $overflowIndicator;
        return $this;
    }

    /**
     * 开启响应式收纳后导航最大可显示数量，超出此数量的导航将被收纳到下拉菜单中，默认为自动计算
     * @param int $maxVisibleCount
     * @return $this
     */
    public function maxVisibleCount(int $maxVisibleCount)
    {
        $this->maxVisibleCount = $maxVisibleCount;
        return $this;
    }
}